home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 August: Tool Chest / Dev.CD Aug 95 TC / Dev.CD Aug 95 TC.toast / Tool Chest / Interfaces / UniversalInterfaces 2.0 / PInterfaces / CMApplication.p < prev    next >
Encoding:
Text File  |  1995-04-18  |  10.5 KB  |  411 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        CMApplication.p
  3.  
  4.      Contains:    Color Matching Application Interfaces.
  5.  
  6.      Version:    Technology:    Color Sync 1.0.5
  7.                  Package:    Universal Interfaces 2.0 in “MPW Latest” on ETO #17
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. }
  19.  
  20. {$IFC UNDEFINED UsingIncludes}
  21. {$SETC UsingIncludes := 0}
  22. {$ENDC}
  23.  
  24. {$IFC NOT UsingIncludes}
  25.  UNIT CMApplication;
  26.  INTERFACE
  27. {$ENDC}
  28.  
  29. {$IFC UNDEFINED __CMAPPLICATION__}
  30. {$SETC __CMAPPLICATION__ := 1}
  31.  
  32. {$I+}
  33. {$SETC CMApplicationIncludes := UsingIncludes}
  34. {$SETC UsingIncludes := 1}
  35.  
  36.  
  37. {$IFC UNDEFINED __TYPES__}
  38. {$I Types.p}
  39. {$ENDC}
  40. {    ConditionalMacros.p                                            }
  41.  
  42. {$IFC UNDEFINED __QUICKDRAW__}
  43. {$I Quickdraw.p}
  44. {$ENDC}
  45. {    MixedMode.p                                                    }
  46. {    QuickdrawText.p                                                }
  47.  
  48. {$IFC UNDEFINED __WINDOWS__}
  49. {$I Windows.p}
  50. {$ENDC}
  51. {    Memory.p                                                    }
  52. {    Events.p                                                    }
  53. {        OSUtils.p                                                }
  54. {    Controls.p                                                    }
  55. {        Menus.p                                                    }
  56.  
  57. {$IFC UNDEFINED __PRINTING__}
  58. {$I Printing.p}
  59. {$ENDC}
  60. {    Errors.p                                                    }
  61. {    Dialogs.p                                                    }
  62. {        TextEdit.p                                                }
  63.  
  64. {$PUSH}
  65. {$ALIGN MAC68K}
  66. {$LibExport+}
  67.  
  68. CONST
  69.     CMTrap                        = $ABEE;
  70.  
  71. { PicComments }
  72.     CMBeginProfile                = 220;
  73.     CMEndProfile                = 221;
  74.     CMEnableMatching            = 222;
  75.     CMDisableMatching            = 223;
  76.  
  77. { Defines for fieldMask in profile search record }
  78.     kMatchCMMType                = $00000001;
  79.     kMatchApplProfileVersion    = $00000002;
  80.     kMatchDataType                = $00000004;
  81.     kMatchDeviceType            = $00000008;
  82.     kMatchDeviceManufacturer    = $00000010;
  83.     kMatchDeviceModel            = $00000020;
  84.     kMatchDeviceAttributes        = $00000040;
  85.     kMatchFlags                    = $00000080;
  86.     kMatchOptions                = $00000100;
  87.     kMatchWhite                    = $00000200;
  88.     kMatchBlack                    = $00000400;
  89.  
  90. { Profile Header version }
  91.     kCMApplProfileVersion        = $0100;
  92.  
  93. { Data types }
  94.     rgbData                        = 'RGB ';
  95.     cmykData                    = 'CMYK';
  96.     grayData                    = 'GRAY';
  97.     xyzData                        = 'XYZ ';
  98.  
  99. { Device types }
  100.     monitorDevice                = 'mntr';
  101.     scannerDevice                = 'scnr';
  102.     printerDevice                = 'prtr';
  103.     qdSystemDevice                = 'sys ';
  104.     qdGDevice                    = 'gdev';
  105.  
  106. { Profile flags }
  107.     CMNativeMatchingPreferred    = $00000001;                    { Default to native not preferred }
  108.     CMTurnOffCache                = $00000002;                    { Default to turn on CMM cache }
  109.  
  110.     
  111. TYPE
  112.     CMMatchFlag = LONGINT;
  113.  
  114. { Profile options }
  115.  
  116. CONST
  117.     CMPerceptualMatch            = $0000;                        { Default. For photographic images }
  118.     CMColorimetricMatch            = $0001;                        { Exact matching when possible }
  119.     CMSaturationMatch            = $0002;                        { For solid colors }
  120.  
  121.     
  122. TYPE
  123.     CMMatchOption = LONGINT;
  124.  
  125.     CMMatchRef = LONGINT;
  126.  
  127.     CWorld = LONGINT;
  128.  
  129. { ColorSync result codes }
  130.  
  131. CONST
  132.     CMNoError                    = 0;
  133.     CMProfileError                = -170;
  134.     CMMethodError                = -171;
  135.     CMMemFullError                = -172;
  136.     CMUnimplementedError        = -173;
  137.     CMParamError                = -174;
  138.     CMMethodNotFound            = -175;                            { CMM not present }
  139.     CMProfileNotFound            = -176;                            { Responder error }
  140.     CMProfilesIdentical            = -177;                            { Profiles the same }
  141.     CMCantConcatenateError        = -178;                            { Profile can't be concatenated }
  142.     CMCantXYZ                    = -179;                            { CMM cant handle XYZ space }
  143.     CMCantDeleteProfile            = -180;                            { Responder error }
  144.     CMUnsupportedDataType        = -181;                            { Responder error }
  145.     CMNoCurrentProfile            = -182;                            { Responder error }
  146.  
  147.     
  148. TYPE
  149.     CMError = LONGINT;
  150.  
  151. {
  152. ** Types
  153. }
  154.     XYZColor = RECORD
  155.         X:                        INTEGER;                                { 1.15 bit unsigned fixed numbers }
  156.         Y:                        INTEGER;
  157.         Z:                        INTEGER;
  158.     END;
  159.  
  160.     CMYKColor = RECORD
  161.         cyan:                    INTEGER;
  162.         magenta:                INTEGER;
  163.         yellow:                    INTEGER;
  164.         black:                    INTEGER;
  165.     END;
  166.  
  167.     CMColor = RECORD
  168.         CASE INTEGER OF
  169.         0: (
  170.             rgb:                        RGBColor;
  171.            );
  172.         1: (
  173.             xyz:                        XYZColor;
  174.            );
  175.         2: (
  176.             cmyk:                        CMYKColor;
  177.            );
  178.     END;
  179.  
  180.     CMColorList = ^CMColor;
  181.  
  182.     CMGamutResult = ^LONGINT;
  183.  
  184.     CMHeader = RECORD
  185.         size:                    LONGINT;                                { This is the total size of the Profile including custom data }
  186.         CMMType:                OSType;                                    { Corresponding CMM }
  187.         applProfileVersion:        LONGINT;                                { Version of CMProfile format }
  188.         dataType:                OSType;                                    { rgbData, etc. }
  189.         deviceType:                OSType;                                    { monitorDevice, etc. }
  190.         deviceManufacturer:        OSType;                                    { Registered with DTS }
  191.         deviceModel:            LONGINT;                                { Specific to Manufacturer }
  192.         deviceAttributes:        ARRAY [0..1] OF LONGINT;                { Attributes like paper, ink, etc. }
  193.         profileNameOffset:        LONGINT;                                { Offset to profile name from top of data }
  194.         customDataOffset:        LONGINT;                                { Offset to custom data from top of data }
  195.         flags:                    CMMatchFlag;
  196.         options:                CMMatchOption;
  197.         white:                    XYZColor;
  198.         black:                    XYZColor;
  199.     END;
  200.  
  201.     CMProfileSearchRecord = RECORD
  202.         header:                    CMHeader;
  203.         fieldMask:                LONGINT;
  204.         reserved:                ARRAY [0..1] OF LONGINT;
  205.     END;
  206.  
  207.     CMProfileSearchRecordPtr = ^CMProfileSearchRecord;
  208.     CMProfileSearchRecordHandle = ^CMProfileSearchRecordPtr;
  209.  
  210.     CMProfileChromaticities = RECORD
  211.         red:                    XYZColor;
  212.         green:                    XYZColor;
  213.         blue:                    XYZColor;
  214.         cyan:                    XYZColor;
  215.         magenta:                XYZColor;
  216.         yellow:                    XYZColor;
  217.     END;
  218.  
  219.     CMResponseData = INTEGER;
  220.  
  221.     IString = RECORD
  222.         theScript:                ScriptCode;
  223.         theString:                Str63;
  224.     END;
  225.  
  226.     IStringPtr = ^IString;
  227.     IStringHandle = ^IStringPtr;
  228.  
  229.  
  230. CONST
  231.     grayResponse                = 0;
  232.     redResponse                    = 1;
  233.     greenResponse                = 2;
  234.     blueResponse                = 3;
  235.     cyanResponse                = 4;
  236.     magentaResponse                = 5;
  237.     yellowResponse                = 6;
  238.     ucrResponse                    = 7;
  239.     bgResponse                    = 8;
  240.     onePlusLastResponse            = 9;
  241.  
  242.     
  243. TYPE
  244.     responseColor = LONGINT;
  245.  
  246.     CMProfileResponse = RECORD
  247.         counts:                    ARRAY [0..onePlusLastResponse-1] OF INTEGER;
  248.         data:                    ARRAY [0..0] OF CMResponseData;            { Variable size }
  249.     END;
  250.  
  251.     CMProfile = RECORD
  252.         header:                    CMHeader;
  253.         profile:                CMProfileChromaticities;
  254.         response:                CMProfileResponse;                        { Variable size }
  255.         profileName:            IString;                                { Variable size }
  256.         customData:                ARRAY [0..0] OF SInt8;                    { Optional variable length custom CMM data }
  257.     END;
  258.  
  259.     CMProfilePtr = ^CMProfile;
  260.     CMProfileHandle = ^CMProfilePtr;
  261.  
  262.     PixMapCallBackProcPtr = ProcPtr;  { FUNCTION PixMapCallBack(progress: LONGINT; refCon: LONGINT): BOOLEAN; }
  263.     PixMapCallBackUPP = UniversalProcPtr;
  264.  
  265. CONST
  266.     uppPixMapCallBackProcInfo = $000003D0; { FUNCTION (4 byte param, 4 byte param): 1 byte result; }
  267.  
  268. FUNCTION NewPixMapCallBackProc(userRoutine: PixMapCallBackProcPtr): PixMapCallBackUPP;
  269.     {$IFC NOT GENERATINGCFM }
  270.     INLINE $2E9F;
  271.     {$ENDC}
  272.  
  273. FUNCTION CallPixMapCallBackProc(progress: LONGINT; refCon: LONGINT; userRoutine: PixMapCallBackUPP): BOOLEAN;
  274.     {$IFC NOT GENERATINGCFM}
  275.     INLINE $205F, $4E90;
  276.     {$ENDC}
  277. {
  278. ** Printing Stuff that will be moved later
  279. }
  280.  
  281. CONST
  282.     enableColorMatchingOp        = 12;
  283.     registerProfileOp            = 13;
  284.  
  285. { PrGeneral parameter blocks }
  286.  
  287. TYPE
  288.     TEnableColorMatchingBlk = RECORD
  289.         iOpCode:                INTEGER;
  290.         iError:                    INTEGER;
  291.         lReserved:                LONGINT;
  292.         hPrint:                    THPrint;
  293.         fEnableIt:                BOOLEAN;
  294.     END;
  295.  
  296.     TRegisterProfileBlk = RECORD
  297.         iOpCode:                INTEGER;
  298.         iError:                    INTEGER;
  299.         lReserved:                LONGINT;
  300.         hPrint:                    THPrint;
  301.         fRegisterIt:            BOOLEAN;
  302.     END;
  303.  
  304. {
  305. ** High Level Calls
  306. }
  307.  
  308. FUNCTION BeginMatching(src: CMProfileHandle; dst: CMProfileHandle; VAR myRef: CMMatchRef): CMError;
  309.     {$IFC NOT GENERATINGCFM}
  310.     INLINE $203c, $000C, 10, $ABEE;
  311.     {$ENDC}
  312. PROCEDURE EndMatching(myRef: CMMatchRef);
  313.     {$IFC NOT GENERATINGCFM}
  314.     INLINE $203c, $0004, 11, $ABEE;
  315.     {$ENDC}
  316. FUNCTION GetProfile(deviceType: LONGINT; refNum: LONGINT; aProfile: CMProfileHandle; VAR returnedProfile: CMProfileHandle): CMError;
  317.     {$IFC NOT GENERATINGCFM}
  318.     INLINE $203c, $0010, 5, $ABEE;
  319.     {$ENDC}
  320. FUNCTION SetProfile(deviceType: LONGINT; refNum: LONGINT; newProfile: CMProfileHandle): CMError;
  321.     {$IFC NOT GENERATINGCFM}
  322.     INLINE $203c, $000c, 6, $ABEE;
  323.     {$ENDC}
  324. FUNCTION SetProfileDescription(deviceType: LONGINT; refNum: LONGINT; deviceData: LONGINT; hProfile: CMProfileHandle): CMError;
  325.     {$IFC NOT GENERATINGCFM}
  326.     INLINE $203c, $0010, 16, $ABEE;
  327.     {$ENDC}
  328. FUNCTION GetColorSyncFolderSpec(vRefNum: INTEGER; createFolder: BOOLEAN; VAR foundVRefNum: INTEGER; VAR foundDirID: LONGINT): CMError;
  329.     {$IFC NOT GENERATINGCFM}
  330.     INLINE $203c, $000c, 17, $ABEE;
  331.     {$ENDC}
  332. FUNCTION GetIndexedProfile(deviceType: LONGINT; refNum: LONGINT; search: CMProfileSearchRecordHandle; VAR returnProfile: CMProfileHandle; VAR index: LONGINT): CMError;
  333.     {$IFC NOT GENERATINGCFM}
  334.     INLINE $203c, $0014, 18, $ABEE;
  335.     {$ENDC}
  336. FUNCTION DeleteDeviceProfile(deviceType: LONGINT; refNum: LONGINT; deleteMe: CMProfileHandle): CMError;
  337.     {$IFC NOT GENERATINGCFM}
  338.     INLINE $203c, $000C, 19, $ABEE;
  339.     {$ENDC}
  340. {
  341. ** Data interchange routines
  342. }
  343. FUNCTION UseProfile(profile: CMProfileHandle): CMError;
  344.     {$IFC NOT GENERATINGCFM}
  345.     INLINE $203c, $0004, 8, $ABEE;
  346.     {$ENDC}
  347. PROCEDURE DrawMatchedPicture(myPicture: PicHandle; dst: CMProfileHandle; VAR myRect: Rect);
  348.     {$IFC NOT GENERATINGCFM}
  349.     INLINE $203c, $000C, 9, $ABEE;
  350.     {$ENDC}
  351. PROCEDURE EnableMatching(enableIt: BOOLEAN);
  352.     {$IFC NOT GENERATINGCFM}
  353.     INLINE $203c, $0002, 13, $ABEE;
  354.     {$ENDC}
  355. {
  356. ** Profile concatenation
  357. }
  358. FUNCTION ConcatenateProfiles(thru: CMProfileHandle; dst: CMProfileHandle; VAR newDst: CMProfileHandle): CMError;
  359.     {$IFC NOT GENERATINGCFM}
  360.     INLINE $203c, $000C, 12, $ABEE;
  361.     {$ENDC}
  362. {
  363. ** Profile manipulation routines
  364. }
  365. PROCEDURE GetProfileName(myProfile: CMProfileHandle; VAR IStringResult: IString);
  366.     {$IFC NOT GENERATINGCFM}
  367.     INLINE $203c, $0008, 14, $ABEE;
  368.     {$ENDC}
  369. FUNCTION GetProfileAdditionalDataOffset(myProfile: CMProfileHandle): LONGINT;
  370.     {$IFC NOT GENERATINGCFM}
  371.     INLINE $203c, $0004, 15, $ABEE;
  372.     {$ENDC}
  373. {
  374. ** Low level color calculation routines
  375. }
  376. FUNCTION CWNewColorWorld(VAR myCWorld: CWorld; src: CMProfileHandle; dst: CMProfileHandle): CMError;
  377.     {$IFC NOT GENERATINGCFM}
  378.     INLINE $203c, $000C, 0, $ABEE;
  379.     {$ENDC}
  380. PROCEDURE CWDisposeColorWorld(myCWorld: CWorld);
  381.     {$IFC NOT GENERATINGCFM}
  382.     INLINE $203c, $0004, 1, $ABEE;
  383.     {$ENDC}
  384. FUNCTION CWMatchColors(myCWorld: CWorld; myColors: CMColorList; count: LONGINT): CMError;
  385.     {$IFC NOT GENERATINGCFM}
  386.     INLINE $203c, $000c, 2, $ABEE;
  387.     {$ENDC}
  388. FUNCTION CWCheckColors(myCWorld: CWorld; myColors: CMColorList; count: LONGINT; result: CMGamutResult): CMError;
  389.     {$IFC NOT GENERATINGCFM}
  390.     INLINE $203c, $0010, 3, $ABEE;
  391.     {$ENDC}
  392. FUNCTION CWMatchPixMap(myCWorld: CWorld; VAR myPixMap: PixMap; progressProc: PixMapCallBackUPP; refCon: LONGINT): CMError;
  393.     {$IFC NOT GENERATINGCFM}
  394.     INLINE $203c, $0010, 4, $ABEE;
  395.     {$ENDC}
  396. FUNCTION CWCheckPixMap(myCWorld: CWorld; VAR myPixMap: PixMap; progressProc: PixMapCallBackUPP; refCon: LONGINT; VAR resultBitMap: BitMap): CMError;
  397.     {$IFC NOT GENERATINGCFM}
  398.     INLINE $203c, $0014, 7, $ABEE;
  399.     {$ENDC}
  400.  
  401. {$ALIGN RESET}
  402. {$POP}
  403.  
  404. {$SETC UsingIncludes := CMApplicationIncludes}
  405.  
  406. {$ENDC} {__CMAPPLICATION__}
  407.  
  408. {$IFC NOT UsingIncludes}
  409.  END.
  410. {$ENDC}
  411.